import urllib2
import logging
import socket
import os
from tools import BASEURL
import urllib
from tools import UUID

tail = 'heartbeat/Mondo'
hearbeat_addr = os.path.join(BASEURL, tail)
param = urllib.urlencode(dict({'state': UUID}))


def main():
    f = urllib2.urlopen(hearbeat_addr, timeout=5, param)
    code = f.getcode()
    result = f.read()
    if code == 200:
        return result
    else:
        raise Exception('HTTP COEE:%d' % code)
